-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partial work on building with Cargo #71029
Conversation
cc @luca-barbieri -- just cherry-picking your commits that I want to approve without some further thought / feedback so that we don't need to rebase them and such. These seem definitely good to have :) @bors r+ Self-approving since I've just cherry-picked @luca-barbieri's commits essentially, with only minor edits to the compiler-rt root. |
📌 Commit 708ae8345b69ed334bddbd82d15ac68e4abc4c83 has been approved by |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors r- |
708ae83
to
7612358
Compare
@bors r+ |
📌 Commit 7612358277bda03959b1bf876e903a5b67cfaa83 has been approved by |
874249c
to
c740496
Compare
Cherry-picked one more commit. @bors r+ |
📌 Commit c740496252ae50388e6173a55006c33e4e5ffc0d has been approved by |
src/librustc_session/lib.rs
Outdated
// Use the test crate here so we depend on getopts through it. This allow tools to link to both | ||
// librustc_session and libtest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it might not be, good call. I think that tools should continue to work with this PR, but I can try and check locally (and if so update this comment) due to the pub use getopts
below. If we do have problems in practice then we can workaround them I think.
@bors r- |
rustc_session exports it for other crates to avoid mismatching crate versions.
The code was broken because it printed "llvm-config" instead of the absolute path to the llvm-config executable, causing Cargo to always rebuild librustc_llvm if using system LLVM. Also, it's not the build system's job to rebuild when a system library changes, so we simply don't emit "rerun-if-changed" if a path to LLVM was not explicitly provided.
x.py sets it unconditionally, so want it for plain "cargo build". We need to load one of the panic runtimes that is in src (vs. pre-built in the compiler's sysroot) to ensure that we don't load libpanic_unwind from the sysroot. That would lead to a load of libcore, also from the sysroot, and create lots of errors about duplicate lang items.
c740496
to
1864caa
Compare
As best as I can tell clippy/miri do build with this, and rustfmt will likely need to bump it's rustc_session dependency (to stop trying to pull getopts from the sysroot). But I believe the comment isn't correct, so approving (I've pushed an update removing it). If it turns out that rustfmt or some other tool does in fact need this I believe it should be true that they can use getopts from the rustc_session in the sysroot. But if that's not right, then we can back this out. @bors r+ |
📌 Commit 1864caa has been approved by |
Rollup of 6 pull requests Successful merges: - rust-lang#71029 (Partial work on building with Cargo) - rust-lang#71034 (Clean up E0515 explanation) - rust-lang#71041 (Update links of `rustc guide`) - rust-lang#71048 (Normalize source when loading external foreign source into SourceMap) - rust-lang#71053 (Add some basic docs to `sym` and `kw` modules) - rust-lang#71057 (Clean up E0516 explanation) Failed merges: r? @ghost
default = ["std_detect_file_io", "std_detect_dlsym_getauxval"] | ||
default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somewhat surprising to me, what's the explanation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to link to some panic runtime for std to build and I believe bootstrap always builds std with panic-unwind linked in today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this negatively affect some -Zbuild-std
uses?
#![feature(test)] | ||
|
||
// Use the test crate here so we depend on getopts through it. This allow tools to link to both | ||
// librustc_session and libtest. | ||
extern crate getopts; | ||
extern crate test as _; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this broke rustfmt and rls in #71059 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right link-related extern crate
s still exist in rustc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error:
error[E0464]: multiple matching crates for `getopts`
--> /cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_session-651.0.0/lib.rs:6:1
|
6 | extern crate getopts;
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: candidates:
crate `getopts`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-2a6246002b81ef60.rlib
crate `getopts`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-c6adfde1f127313e.rlib
error[E0463]: can't find crate for `getopts`
--> /cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_session-651.0.0/lib.rs:6:1
|
6 | extern crate getopts;
| ^^^^^^^^^^^^^^^^^^^^^ can't find crate
error: aborting due to 2 previous errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems likely, but I'm pretty sure that once y'all bump the autopublished librustc_session crate then things should work. If not, please do let me know, we can re-add this here as needed.
This cherry picks the commits I'm directly approving from #70999, I want to land them so that that PR is smaller.